﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace T.FAS.Runtime.Base.Entity
{
    /// <summary>
    /// 低代码CDO变更集
    /// </summary>
    [Serializable]
    public class ChangeSet
    {
        /// <summary>
        /// 索引器
        /// </summary>
        /// <param name="itemName">变更项列名</param>
        /// <returns>变更项</returns>
        public ChangeItem this[string itemName]
        {
            get
            {
                return ChangeItems?.Where(item => item.ItemCode == itemName)?.FirstOrDefault();
            }
        }

        /// <summary>
        /// 标识
        /// </summary>
        public string ID { get; set; }

        /// <summary>
        /// 变更集标识
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 主单据变更动作
        /// </summary>
        public string Action { get; set; }

        /// <summary>
        /// 变更描述
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// 变更单据标识
        /// </summary>
        public string BillID { get; set; }

        /// <summary>
        /// 变更单据类型标识:CDO ID
        /// </summary>
        public string MetaID { get; set; }

        /// <summary>
        /// 变更单据类型编号:CDO编号
        /// </summary>
        public string MetaType { get; set; }

        /// <summary>
        /// 变更单据类型名称:CDO名称
        /// </summary>
        public string MetaName { get; set; }

        /// <summary>
        /// 用户标识
        /// </summary>
        public string UserID { get; set; }

        /// <summary>
        /// 用户名称
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 租户ID
        /// </summary>
        public string TenantID { get; set; }

        /// <summary>
        /// 变更时间
        /// </summary>
        public DateTime ChangeTime { get; set; }

        /// <summary>
        /// 变更详情
        /// </summary>
        public List<ChangeItem> ChangeItems { get; set; }

        /// <summary>
        /// 扩展字段
        /// </summary>
        public string Ext1 { get; set; }

        /// <summary>
        /// 扩展字段
        /// </summary>
        public string Ext2 { get; set; }

        /// <summary>
        /// 扩展字段
        /// </summary>
        public string Ext3 { get; set; }

        /// <summary>
        /// 扩展字段
        /// </summary>
        public string Ext4 { get; set; }

        /// <summary>
        /// 扩展字段
        /// </summary>
        public string Ext5 { get; set; }
    }
}
